/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2017-5-30      Bernard      the first version
 */
#include <stdio.h>
#include <rtthread.h>
#include "drv_gpio.h"
#include "drv_clock.h"
// #include "drv_spi.h"
// #include <fal.h>

#define THREAD_PRIORITY         25
#define THREAD_STACK_SIZE       512
#define THREAD_TIMESLICE        5

static rt_thread_t tid1 = RT_NULL;

static void thread1_entry(void *parameter)
{
    while (1)
    {
        rt_thread_mdelay(500);
        gpio_direction_output(GPIO_PORT_D, GPIO_PIN_22, 0);
        rt_thread_mdelay(500);
        gpio_direction_output(GPIO_PORT_D, GPIO_PIN_22, 1);
    }
}

int main(int argc, char **argv)
{
    rt_kprintf("******rt-thread bootloader run*******\n");

    
    sunxi_clk_dump();

    /* 创建线程 1，名称是 thread1，入口是 thread1_entry*/
    tid1 = rt_thread_create("thread1",
                            thread1_entry, RT_NULL,
                            THREAD_STACK_SIZE,
                            THREAD_PRIORITY, THREAD_TIMESLICE);

    /* 如果获得线程控制块，启动这个线程 */
    if (tid1 != RT_NULL)
        rt_thread_startup(tid1);
    return 0;
}

